<?php

class Public_Applet_LoginSuccessView extends BlogPublicBaseView
{

	public function executeHtml(AgaviRequestDataHolder $rd)
	{
		$this->setupHtml($rd, 'slot');
		/* @var $user BlogUser */
		$user = $this->getContext()->getUser();
		
		if ($user->isAuthenticated()) {
		    $this->setAttribute('username', $user->getAttribute('username'));
		} else {
		    // get username from cookies
		    $username = $rd->getCookie('login_username');
		    if (is_null($username)) { 
                $username = '';
		    }
            $this->setAttribute('saved_username', $username);
		    // get openid from cookies
		    $username = $rd->getCookie('login_openid');
            if (is_null($username)) {
                $username = '';
            }
            $this->setAttribute('saved_openid', $username);
		}

		$this->setAttribute('title', 'Login');
	}
}

?>
